[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 Simple bar graphs    How to make them with R&R on nearly every printer

 The replicate() function offers a handy tool for creating bar charts.
 You can quicky adapt a sales analysis report into a bar chart.

     +----------------------------------------------------------+
     |                PRODUCT SALES IN JANUARY                  |
     |                                                          |
     | Rick   |######## 5 (33%)                                 |
     |        |#################### 10 (67%)                    |
     |        |############################## 15 (34%)          |
     |        |                                                 |
     | Ellen  |############## 6 (40%)                           |
     |        |#################### 10 (67%)                    |
     |        |################################ 16 (40%)        |
     |        |                                                 |
     |        |####### 4 (26%)                                  |
     | Peter  |######### 5 (33%)                                |
     |        |################## 9 (20%)                       |
     |        |                                                 |
     |        +-------------------------------------+           |
     |                  5        10        15                   |
     |                                                          |
     |                       Product                            |
     |            dBr ####   R&R ####   Total ####              |
     +----------------------------------------------------------+

 Note that to print this bar chart your printer must support the Extended
 IBM Character Set. The followoing characters are used:

          chr(176)  #     chr(178) #       chr(219) #

 The line and shading characters can be typed using [Shift-F3] to select
 and [F3] to enter. You can alternatively type these characters by holding
 down the [Alt] key, typing the character number on the numeric keypad, and
 then releasing the [Alt] key.

 To create the example bar chart, first create the sales analysis report
 using standard ways of totalling the product sales for the two different
 products.

 You need to create two calculated fields to produce the bars. One field
 produces a bar for each product detail record and the other field produces
 a total bar for each sales rep. Using the /Field Calculate Create command,
 enter the following calculated field expressions.

  Detail_Bar =
  replicate(iif(DETAIL->PRODUCTS='dBR','#', '#'), 2 * DETAIL->QUANTITY)

  Total_Bar =
  replicate('#, 2 * SUBTOT->QUANTITY)

 The expression for Detail Bar says "replicate the shading character twice
 as man~ times as the quantity sold, using the lighter shading character if
 the product is dBR and the darker shading character if the product is
 R&R".

 Note how you can scale the bar to an appropriate size. In this case the
 graph would have been too compressed had we not multiplied the quantity by
 two. If you are dealing in millions of dollars, divide by one million so
 the bar will fit on a nice size graph.

 Next, use the /Line commands to modify the report layout according to the
 screen in Figure 5-2. Edit the report title and delete all of the fields
 except DETAIL->SALESREP. Then enter the new text and insert the fields as
 they appear on the screen.

 When you insert the bar fields, the width is initially set to 20. Use the
 /Field Width command to extend them to 40. Next to these fields insert the
 quantity and % of total fields for reference.

 Insert the quantity from the detail file and the % of sales rep total on
 the body line. Insert the quantity from the subtotal file and the % of
 company total on the sales rep group footer line (level 2).

 Between the bar and number fields enter text fields that contain spaces
 and parentheses (spaces are displayed as dots on the screen). Note how
 automatic trim positions the quantity and % of total next to the bar
 regardless of its width. Automatic trim removes extra spaces from a data
 field when any other field is placed immediately to its right.

 If needed, you can use a preprocessed total to deterime the maximum sales
 and use this preprocessed total to size the bar graph.


This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson